The Anchorage
Personal website of Gregory K. Maxey, Commander USN (Retired)
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
The Microsoft Word Find/Replace utility is probably one of the most popular features for beginner and intermediate Word users. It is a powerful tool capable of seemingly magical document transformations. There is a pitfall.
So what's the problem? Plenty! When non-printing characters are displayed, paragraph mark is represented with a "Pilcrow" symbol shown below.
The Pilcrow symbol is displayed with with ASCII character 13. Using ^13 in the "Replace With" field gives the appearance that whatever was ... has been replaced with a paragraph. However, a Word paragraph is more than just its symbol. It is really more like a "packet," and that packet is defined with the ACSII characters 13 and 10 in succession. While the end of individual paragraph packets are represented by ASCII 13, the packet itself holds all of the the formatting and style of the paragraph (i.e., it gives the paragraph its identity).
Consider the following simple list:
In the example text, list items are separated by line breaks. This is a common situation when copying text from the web. Let's use the Find and Replace utility to find the line breaks and replace them with what we mistakenly think is a paragraph or with "^13"
Both the displayed dialog and resulting text would lead us to believe that the line breaks have in fact been replaced with paragraphs. However, let's look at some implications of this change.
Click on the first item in the list and try to apply a style. As you can see from the illustrations below the result is completely unexpected. Instead of the Heading 2 style being applied to the text "Mississippi," it was applied to all of the items in the list.
Next select the five state names and try to sort. Again the result is frustrating and completely unexpected.
Note: To sort text with Word 2003 use Table>Sort>Sort by "paragraphs." In Word 2007/2010 the sort command is located on the Home tab in the Paragraph group.
It should be apparent now that things have gotten all tangled up!! For more proof, run the following macro on the selected text:
Sub CountParas() MsgBox "The selection contains " _ & Selection.Paragraphs.Count & " paragraph(s)." lbl_Exit: Exit Sub End Sub
See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.
You may not be surprised now by the result:
The problem should now be apparent. What looks like five paragraphs is in fact only 1. The style was applied to "1" paragraph (containing all five state names) and the sort failed because "How do you sort one thing?" By using ^13 to replace the line breaks with a paragraph you only tagged the end of the lines with a paragraph symbol. You did not put the text into paragraph "packets." To replace a line break and put the string of text preceding into a paragraph (i.e., a paragraph "packet" with an identity), you have to use ^p.
I hope that these illustrations help you to remember to:
The work around is simple. You can (and should) always use ^p in the "Replace With" window to replace found text with a paragraph
That's it! I hope you have found this tips page useful and informative.
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!